package struts.action;

import java.util.ArrayList;
import java.util.List;

import javax.naming.InitialContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import ejb.bl.MusicStoreBLRemote;

public class WelcomeAction extends Action {
	private MusicStoreBLRemote MusicStoreBLBean;
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		List list = new ArrayList();
		InitialContext ic = new InitialContext();
		MusicStoreBLBean = (MusicStoreBLRemote) ic
				.lookup("java:global/IMusicStore/MusicStoreStalessBean");
		list = MusicStoreBLBean.loadCdList();

		request.setAttribute("cdList", list);	
		return mapping.findForward("success");
	}
}